package com.codegeek.project.slope.service.impl;

import com.codegeek.common.utils.DateUtils;
import com.codegeek.project.slope.domain.SlopeHistoryVideo;
import com.codegeek.project.slope.mapper.SlopeHistoryVideoMapper;
import com.codegeek.project.slope.service.ISlopeHistoryVideoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 历史视频Service业务层处理
 *
 * @author codegeek
 * @date 2020-02-17
 */
@Service
public class SlopeHistoryVideoServiceImpl implements ISlopeHistoryVideoService {
    @Autowired
    private SlopeHistoryVideoMapper slopeHistoryVideoMapper;

    /**
     * 查询历史视频
     *
     * @param historyVideoId 历史视频ID
     * @return 历史视频
     */
    @Override
    public SlopeHistoryVideo selectSlopeHistoryVideoById(Long historyVideoId) {
        return slopeHistoryVideoMapper.selectSlopeHistoryVideoById(historyVideoId);
    }

    /**
     * 查询历史视频列表
     *
     * @param slopeHistoryVideo 历史视频
     * @return 历史视频
     */
    @Override
    public List<SlopeHistoryVideo> selectSlopeHistoryVideoList(SlopeHistoryVideo slopeHistoryVideo) {
        return slopeHistoryVideoMapper.selectSlopeHistoryVideoList(slopeHistoryVideo);
    }

    /**
     * 新增历史视频
     *
     * @param slopeHistoryVideo 历史视频
     * @return 结果
     */
    @Override
    public int insertSlopeHistoryVideo(SlopeHistoryVideo slopeHistoryVideo) {
        slopeHistoryVideo.setCreateTime(DateUtils.getNowDate());
        return slopeHistoryVideoMapper.insertSlopeHistoryVideo(slopeHistoryVideo);
    }

    /**
     * 修改历史视频
     *
     * @param slopeHistoryVideo 历史视频
     * @return 结果
     */
    @Override
    public int updateSlopeHistoryVideo(SlopeHistoryVideo slopeHistoryVideo) {
        return slopeHistoryVideoMapper.updateSlopeHistoryVideo(slopeHistoryVideo);
    }

    /**
     * 批量删除历史视频
     *
     * @param historyVideoIds 需要删除的历史视频ID
     * @return 结果
     */
    @Override
    public int deleteSlopeHistoryVideoByIds(Long[] historyVideoIds) {
        return slopeHistoryVideoMapper.deleteSlopeHistoryVideoByIds(historyVideoIds);
    }

    /**
     * 删除历史视频信息
     *
     * @param historyVideoId 历史视频ID
     * @return 结果
     */
    @Override
    public int deleteSlopeHistoryVideoById(Long historyVideoId) {
        return slopeHistoryVideoMapper.deleteSlopeHistoryVideoById(historyVideoId);
    }
}
